package com.chinasi.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.caland.framework.core.page.Pager;
import com.chinasi.dao.ConsultBasicDao;
import com.chinasi.model.ConsultBasic;
import com.chinasi.service.ConsultBasicService;

@Service
public class ConsultBasicServiceImpl implements ConsultBasicService {

	/**
	 * ConsultBasicDAO
	 */
	@Autowired
	private ConsultBasicDao ConsultBasicDao;

	@Override
	public Pager findPageCondition(ConsultBasic searchBean, int currentPage) {
		Pager pager = new Pager(ConsultBasicDao.getTotalCount(searchBean),currentPage);
		pager.setData(ConsultBasicDao.findByCondition(searchBean, pager.getStartRow(), pager.getPageSize()));
		return pager;
	}

	@Override
	public ConsultBasic findById(String id) {
		return ConsultBasicDao.findByPK(id, ConsultBasic.class);
	}
	
	@Override
	public int findTotalCount(){
		return ConsultBasicDao.getTotalCount(new ConsultBasic());
	}

}
